package com.shareyi.baseproject.kernel.common.retry;

import com.shareyi.baseproject.kernel.common.constants.CommonConstant;
import org.apache.commons.lang3.StringUtils;

/**
 * 重试订阅者常量
 *
 * @author david
 * @date 2020-04-14
 */
public class RetrySubscriberConstant {

    /**
     * 订阅者名称
     */
    public static class SubscriberNames {
        /**
         * 默认的订阅者名称
         */
        public static final String DEFAULT = "";

    }


    public static class Utils {
        /**
         * 构建处理器contextKey
         *
         * @param cmd
         * @param subscriberName
         * @return
         */
        public static String buildHandlerContextKey(String cmd, String subscriberName) {
            return StringUtils.isEmpty(subscriberName) ? cmd : cmd + CommonConstant.LINE_STR + subscriberName;
        }

    }


}
